/* jshint globalstrict: true */
/* module: false */
define(['WebPDF', 
	'angularMocks', 
	'../../../base/app/js/PDFView/PDFDocService', 
	'./PDFDocDataMock'], function(WebPDF, angularMocks, PDFDocService, PDFDocData) {
		'use strict';
	describe('PDFDocService', function() {
		var $httpBackend;

		beforeEach(module('WebPDF'));

		beforeEach(inject(function(_$httpBackend_) {
			$httpBackend = _$httpBackend_;
			$httpBackend.expectGET('/app/pdfdata/doc-1/PagesInfo_form').respond(PDFDocData);
		}));


		it('check the existence of PDFDocService', inject(function(PDFDocService) {
			expect(PDFDocService).toBeDefined();
		}));


		it('load document from service', function (done) {
			inject(function(PDFDocService) {
				var pdfDoc;
				PDFDocService.getPDFDoc().then(
					function(data) {
						pdfDoc = data;						
						expect(pdfDoc.pdfPages.length).toBe(4);
						expect(pdfDoc.docProperties.getAuthor()).toBe("SE:W:CAR:MP");
						expect(pdfDoc.docProperties.getVersion()).toBe("PDF-1.7");
						expect(pdfDoc.pdfPages[3].pageHeight).toBe(792);
						done();
					},
					function() {
						//expect whatever not to be here
						expect(true).toBe(false);
						done();
					});
				$httpBackend.flush();						
			});
		});
	});
});